package com.wits.qso.service;

import java.util.Date;

import javax.persistence.NoResultException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.support.DaoSupport;
import org.springframework.stereotype.Component;

import com.wits.platform.service.BaseService;
import com.wits.qso.dao.YearDao;
import com.wits.qso.entity.Year;


@Component
public class YearService extends BaseService<Year, String>
{

	private YearDao yearDao;

	@Autowired
	public void setYearDao(YearDao yearDao) {
		this.baseDao = yearDao;
		this.yearDao = yearDao;
	}

	public Year findNow(Date now) {
		Year result = null;

		try {
			result = yearDao.findNow( now );
		} catch (NoResultException cause) {
		}
		
		return result;
	}
	
	public Year findEnabled() {
		return yearDao.findEnabled();
	}
	
	public boolean hasYearByTitle(String title) {
		return null != yearDao.findByTitle( title );
	}
}
